package utils

import (
	"github.com/bwmarrin/snowflake"
	"github.com/pkg/errors"
	"github.com/zeromicro/go-zero/core/logx"
)

func GenSnowFlakeID() (int64, error) {
	node, err := snowflake.NewNode(1)
	if err != nil {
		logx.Errorf("生成雪花id失败：%v", err)
		return 0, errors.Wrap(err, "雪花工具包错误")
	}

	return node.Generate().Int64(), nil
}
